import pandas as pd
pd.set_option('display.unicode.east_asian_width',True)

# df1 = pd.DataFrame({'原时间信息': ['02/28/2022 12:23:21', '2022.02.28', '2022/02/28', '20220228', '28-Feb-2022']})
# df1['转换后的时间'] = pd.to_datetime(df1['原时间信息'])
# print('时间的转换：\n', df1)

df2 = pd.DataFrame({'year': ['2020', '2021', '2022'],
                    'month': ['1', '6', '12'],
                    'day': ['1', '30', '31'],
                    'hour': ['1', '13', '18'],
                    'minute': ['1', '14', '30'],
                    'second': ['1', '0', '0']})
df2['组合后的时间'] = pd.to_datetime(df2)
print('时间的组合：\n', df2)

df3 = df2['组合后的时间']
df4 = pd.DataFrame()
df4['年'], df4['月'], df4['日'] = df3.dt.year, df3.dt.month, df3.dt.day
df4['时'], df4['分'], df4['秒'] = df3.dt.hour, df3.dt.minute, df3.dt.second
df4['星期'], df4['季度'] = df3.dt.weekday + 1, df3.dt.quarter
df4['是否年底'], df4['是否月底'] = df3.dt.is_year_end,df3.dt.is_month_end
print('时间的提取：\n',df4)